package com.durian.base.frame.titlebar

import com.durian.base.frame.activity.ActivityFrame
import com.gyf.immersionbar.ImmersionBar

/**
 * 说明：BaseSuperTitleBar
 * <p/>
 * 作者：Fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2020/08/14 17:24
 * <p/>
 * 版本：version 1.0
 */
abstract class BaseSuperTitleBar : ISuperTitleBar{

    lateinit var immersionBar : ImmersionBar
    var activity : ActivityFrame? = null

    override fun bindActivity(activity: ActivityFrame){
        this.activity = activity
        immersionBar = ImmersionBar.with(activity)
    }

    fun statusBarDarkFont(isDarkFont: Boolean) {
        if (this::immersionBar.isInitialized){
            immersionBar.statusBarDarkFont(isDarkFont, 0.2f).init()
        }
    }

    fun navigationBarColor(navigationBarColor: Int) {
        if (this::immersionBar.isInitialized){
            immersionBar.navigationBarColor(navigationBarColor).init()
        }
    }

    fun statusBarColor(statusBarColor: Int) {
        if (this::immersionBar.isInitialized){
            immersionBar.statusBarColor(statusBarColor).init()
        }
    }

    override fun unBind() {
        activity = null
    }

}